home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1998 #1 / Amiga Plus 1998 #1.iso / demo-versionen / haage&partner / warpup-warpos / source / pixelomania.p < prev    next >
Text File  |  1997-09-24  |  5KB  |  169 lines

  1.                 incdir  include:
  2.                 incdir  lvo:
  3.  
  4. **      '(C) Copyright 1997 Haage & Partner Computer GmbH'
  5. **           All Rights Reserved
  6.  
  7.                 include intuition/intuition.i
  8.                 include devices/timer.i
  9.                 include powerpc/ppcmacros.i
  10.                 include powerpc/powerpc.i
  11.  
  12.                 include exec_lib.i
  13.                 include dos_lib.i
  14.                 include intuition_lib.i
  15.                 include graphics_lib.i
  16.                 include powerpc_lib.i
  17.  
  18.                 xref    _PowerPCBase
  19.                 xref    _SysBase
  20.                 xref    _DOSBase
  21.                 xref    _LinkerDB
  22.  
  23.                 smalldata
  24.                 executable
  25.                 escapestr
  26.  
  27.                 section "PixelOMania",code
  28.  
  29. WINDOWWIDTH     =       200
  30. WINDOWHEIGHT    =       100
  31.  
  32. start
  33.                 prolog
  34.                 pushgpr r26-r31
  35.                 la      r6,int_name
  36.                 li      r3,0
  37.                 RUN68K  _SysBase,OpenLibrary
  38.                 tstw    r3
  39.                 beq     .end
  40.                 sw      r3,_IntuitionBase
  41.                 la      r6,gfx_name
  42.                 li      r3,0
  43.                 RUN68K  _SysBase,OpenLibrary
  44.                 tstw    r3
  45.                 beq     .closeint
  46.                 sw      r3,_GfxBase
  47.                 la      r4,title
  48.                 la      r22,Args
  49.                 RUN68K_XL       _DOSBase,VPrintf
  50.                 li      r5,0
  51.                 la      r6,WindowTags
  52.                 RUN68K  _IntuitionBase,OpenWindowTagList
  53.                 tstw    r3
  54.                 beq     .closegfx
  55.                 sw      r3,_Window
  56.                 lwz     r31,wd_UserPort(r3)
  57.                 lwz     r29,wd_RPort(r3)
  58.                 sw      r29,_RPort
  59.                 li      r30,0
  60.                 li      r28,0
  61.                 li      r27,0
  62.                 li      r26,1
  63.                 la      r4,TimeVal1
  64.                 CALLPOWERPC     GetSysTimePPC
  65. .loop
  66.                 mr      r5,r31
  67.                 RUN68K  _SysBase,GetMsg
  68.                 tstw    r3
  69.                 beq     .nomsg
  70.                 lwz     r4,im_Class(r3)
  71.                 liw     r5,IDCMP_MOUSEBUTTONS
  72.                 and.    r4,r4,r5
  73.                 beq     .nomsg
  74.                 li      r30,-1
  75.                 mr      r6,r3
  76.                 RUN68K  _SysBase,ReplyMsg
  77. .nomsg
  78.                 tstw    r30
  79.                 bne     .abort
  80.                 mr      r6,r29
  81.                 mr      r3,r26
  82.                 xori    r26,r26,2
  83.                 RUN68K  _GfxBase,SetAPen
  84.                 mr      r6,r29
  85.                 mr      r3,r27
  86.                 mr      r4,r28
  87.                 RUN68K  _GfxBase,WritePixel
  88.                 addi    r27,r27,1
  89.                 cmplwi  r27,WINDOWWIDTH
  90.                 blt     .loop
  91.                 li      r27,0
  92.                 addi    r28,r28,1
  93.                 cmplwi  r28,WINDOWHEIGHT
  94.                 blt     .loop
  95.                 la      r4,TimeVal2
  96.                 CALLPOWERPC     GetSysTimePPC
  97.                 la      r4,TimeVal2
  98.                 la      r5,TimeVal1
  99.                 CALLPOWERPC     SubTimePPC
  100.                 la      r4,TimeVal2
  101.                 lwz     r0,TV_MICRO(r4)
  102.                 push    r0
  103.                 lwz     r0,TV_SECS(r4)
  104.                 push    r0
  105.                 la      r4,time
  106.                 mr      r22,local
  107.                 RUN68K_XL       _DOSBase,VPrintf
  108.                 addi    local,local,8
  109.                 b       .close
  110. .abort
  111.                 la      r4,abort
  112.                 la      r22,Args
  113.                 RUN68K_XL       _DOSBase,VPrintf
  114. .close
  115.                 lw      r5,_Window
  116.                 RUN68K  _IntuitionBase,CloseWindow
  117. .closegfx
  118.                 lw      r6,_GfxBase
  119.                 RUN68K  _SysBase,CloseLibrary
  120. .closeint
  121.                 lw      r6,_IntuitionBase
  122.                 RUN68K  _SysBase,CloseLibrary
  123. .end
  124.                 popgpr
  125.                 epilog
  126.  
  127.  
  128.                 section "PixelOMania",data
  129.  
  130. int_name        INTNAME
  131. gfx_name        GRAFNAME
  132. title           dc.b    "\nPixelOMania V1.0  18.9.97 by Sam Jordan\n"
  133.                 dc.b    "---------------------------------------\n"
  134.                 dc.b    "Measures the performance of CPU context switches\n"
  135.                 dc.b    "In every iteration (for every pixel) four AMIGAOS\n"
  136.                 dc.b    "system functions are called by the PowerPC\n\n"
  137.                 dc.b    "Click on the window to abort the program\n"
  138.                 dc.b    "Let's go:\n\n",0
  139. abort           dc.b    "Program aborted\n",0
  140. time            dc.b    "Time elapsed: %ld.%06ld seconds\n\n",0
  141.  
  142.  
  143.                 cnop    0,4
  144.  
  145. WindowTags      dc.l    WA_Left
  146.                 dc.l    100
  147.                 dc.l    WA_Top
  148.                 dc.l    100
  149.                 dc.l    WA_Width
  150.                 dc.l    WINDOWWIDTH
  151.                 dc.l    WA_Height
  152.                 dc.l    WINDOWHEIGHT
  153.                 dc.l    WA_Activate
  154.                 dc.l    -1
  155.                 dc.l    WA_IDCMP
  156.                 dc.l    IDCMP_MOUSEBUTTONS
  157.                 dc.l    TAG_DONE
  158.  
  159.  
  160.                 section "PixelOMania",bss
  161.  
  162. _IntuitionBase  ds.l    1
  163. _GfxBase        ds.l    1
  164. _Window         ds.l    1
  165. _RPort          ds.l    1
  166. TimeVal1        ds.b    TV_SIZE
  167. TimeVal2        ds.b    TV_SIZE
  168. Args            ds.l    2
  169.